import type {RouteRecordRaw} from 'vue-router'
import {createRouter, createWebHashHistory} from 'vue-router'
import {loadable} from '@/utile/loadable'

export type RouteType = RouteRecordRaw & {
    name:string,
    meta:{
        title:string,
        keepAlive?:boolean
    }
}

const routes: Array<RouteType> = [
    {
        path: '/',
        name: 'Home',
        component: loadable(()=>import('@/view/Home/Home.vue')),
        meta: {
            title: '首页',
            keepAlive: true, // 组件需要缓存
        }
    }
]

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes
})


export default router
